package com.cqut.familiarity.service.impl;

import com.cqut.familiarity.entity.Answer;
import com.cqut.familiarity.entity.Questionnaire;
import com.cqut.familiarity.entity.vo.ResultVO;
import com.cqut.familiarity.entity.vo.questionVO.CompletedQuestionVO;
import com.cqut.familiarity.entity.vo.questionVO.IncompletelyQuestionVO;
import com.cqut.familiarity.entity.vo.questionnaireVO.CompletedQuestionaireVO;
import com.cqut.familiarity.entity.vo.questionnaireVO.IncompletelyQuestionnaireVO;
import com.cqut.familiarity.mapper.QuestionnaireMapper;
import com.cqut.familiarity.service.QuestionnaireService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author atao
 * @since 2021-05-23
 */
@Service
public class QuestionnaireServiceImpl extends ServiceImpl<QuestionnaireMapper, Questionnaire> implements QuestionnaireService {

    @Autowired
    private QuestionnaireMapper questionnaireMapper;



    @Override
    public List<IncompletelyQuestionVO> getDetailsOfIncompletely(String questionnaire_id) {
        return questionnaireMapper.selectDetailsOfIncompletely(questionnaire_id);
    }

    @Override
    public List<ResultVO> listAboutMe(String user1_id) {
        return questionnaireMapper.listAboutMe(user1_id);
    }

    @Override
    public List<ResultVO> listAboutFriend(String user2_id) {
        return questionnaireMapper.listAboutFriend(user2_id);
    }

    @Override
    public List<CompletedQuestionVO> getDetailsOfCompelted(String user1_id, String user2_id, String questionnaire_id) {
        return questionnaireMapper.selectDetailsOfCompelted(user1_id,user2_id,questionnaire_id);
    }

    @Override
    public List<IncompletelyQuestionnaireVO> incompletelyPageByTitle(int pageIndex, int pageSize, String title, String id) {
        return questionnaireMapper.incompletelyPageByTitle(pageIndex,pageSize,title,id);
    }

    @Override
    public List<CompletedQuestionaireVO> completedPageByTitle(int pageIndex, int pageSize, String title, String id) {
        return questionnaireMapper.completedPageByTitle(pageIndex,pageSize,title,id);
    }

    @Override
    public int saveResult(String user1_id, String user2_id, String questionnaire_id, double result) {
        return questionnaireMapper.saveResult(user1_id,user2_id,questionnaire_id,result);
    }

    @Override
    public int saveAnswer(Answer answer) {
        return questionnaireMapper.insertAnswer(answer);
    }

    @Override
    public String isFill(String user1_id, String user2_id, String questionnaire_id) {
        return questionnaireMapper.isFill(user1_id,user2_id,questionnaire_id);
    }

    @Override
    public CompletedQuestionaireVO completedById(String user1_id, String user2_id, String questionnaire_id) {
        return questionnaireMapper.completedById(user1_id,user2_id,questionnaire_id);
    }

    @Override
    public IncompletelyQuestionnaireVO incompletelyById(String user1_id, String user2_id, String questionnaire_id) {
        return questionnaireMapper.incompletelyById(user1_id,user2_id,questionnaire_id);
    }

    @Override
    public List<ResultVO> listAboutFriend2(String user2_id) {
        return questionnaireMapper.listAboutFriend2(user2_id);
    }

    @Override
    public List<ResultVO> listAboutFriend22(String user2_id) {
        return questionnaireMapper.listAboutFriend22(user2_id);
    }
}
